/*
 * common.h
 *
 *  Created on: Dec 13, 2011
 *      Author: piotrek
 */

#ifndef COMMON_H_
#define COMMON_H_

// 8192 - maksymalny rozmiar wiadomosci
#define MAX_PAYLOAD 1024

#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/msg.h>
#include <stdlib.h>
#include <pthread.h>

#define DISPATCHER_KEY 696969;
#define NULL_PID -1

struct monitoring_req{
	long mtype;
	key_t message_queue_key;
	pid_t pid_to_be_monitored;
	int interval;
};

struct monitor_thread {
	pthread_t thread_id;
	struct monitoring_req monitoring_req;
};

struct monitor_response {
	long mtype;
	int message_id;
	char payload[MAX_PAYLOAD];
};

enum thread_status {
	CONTINUE,
	EXIT
};

int create_fake_response(char data [], size_t data_size, struct monitor_response *response);
size_t create_fake_data(char **buff);

#endif /* COMMON_H_ */
